<p id="notice"><%= notice %></p>

<h3>
  <%= @post.title %> - <%= link_to 'Edit', edit_post_path(@post) %>
</h3>

<p>
  <b>Post:</b>
  <%= @post.post %>
</p>

<p>
  <b>User:</b>
  <%= @post.user_id %>
</p>

<h4>Comments</h4>
<% @post.comments.each do |c| %>
<p><em><%= c.user.username %> says</em></p> <p><%= c.comment %></p>
<% end %>

<% form_for (@comment) do |p| %>
<h5>Leave a comment</h5>
	<%= p.hidden_field :post_id %>
	<p>
	<%= p.label :comment %><br />
	<%= p.text_area :comment %>
	</p>
	<p>
	<%= p.label :user_id %><br />
	<% users_array = User.all.map { |u| [u.username, u.id] } %>
	<%= p.select(:user_id, users_array)%>
	</p>
	<p>
	<%= p.submit "Post comment" %>
	</p>
<% end %>

<%= link_to 'Back', posts_path %>
